package com.wu.llpsw.item.wuyao;

import com.wu.llpsw.data.playerData;
import com.wu.llpsw.networking.ModMessage;
import com.wu.llpsw.networking.packet.backYuanLiMaxPacket;
import com.wu.llpsw.networking.packet.backYuanLiNowPacket;
import com.wu.llpsw.yuanli.energy.yuanliManager;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class kuangbaodan extends yuan_mi{
    public kuangbaodan(Properties p_41383_, int my) {
        super(p_41383_, my);
    }
    private static final FoodProperties food = (
            new FoodProperties.Builder())
            .nutrition(0)
            .saturationMod(0.0F)
            .fast()
            .build();

    //添加描述
    @Override
    public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) {
        p_41423_.add(new TranslatableComponent("tooltip.wu.kuangbaodan.tooltip"));
    }

    //吃完进入狂暴效果
    @Override
    public ItemStack finishUsingItem(ItemStack itemStack, Level world, LivingEntity entity) {
        if(entity instanceof Player){
            Player player=(Player) entity;
            player.addEffect(new MobEffectInstance(MobEffects.POISON, 20 * 10, 0));
            player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 20 * 10, 4));
            player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 20 * 10, 1));
            player.addEffect(new MobEffectInstance(MobEffects.SATURATION, 20 * 10, 1));

        }
        return super.finishUsingItem(itemStack, world, entity);
    }
}
